package com.lq.service.impl;

import com.lq.mapper.CommentMapper;
import com.lq.pojo.Comment;
import com.lq.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CommentServiceImpl implements CommentService {

    @Autowired
    private CommentMapper commentMapper;

    @Override
    public Integer getNumOfAllCommentByUserId(Integer userId) {
        return commentMapper.getNumOfAllCommentByUserId(userId);
    }

    @Override
    public List<Comment> getLatestComment(Integer limit) {
        return commentMapper.getLatestComment(limit);
    }

    @Override
    public Integer getCommentNumByArticleId(Integer articleId) {
        return commentMapper.getCommentNumByArticleId(articleId);
    }

    @Override
    public List<Comment> getAllComment(Integer limit) {
        return commentMapper.getAllComment(limit);
    }

    @Override
    public boolean deleteCommentByCommentId(Integer commentId) {
        return commentMapper.deleteCommentByCommentId(commentId);
    }

    @Override
    public List<Comment> getCommentsByArticleId(Integer articleId) {
        return commentMapper.getCommentsByArticleId(articleId);
    }
}
